package com.sqj.proxyPattern.custom;

import java.lang.reflect.Method;

public class Meipo implements SqjInvocationHandler{
    private Object target;

    public Object getInstance(Object target)throws Exception{
        this.target=target;
        Class<?> clazz = target.getClass();
        return SqjProxy.newInstance(new SqjClassLoader(), clazz.getInterfaces(),this);
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        before();
        method.invoke(this.target,args);
        return null;
    }

    private void before(){
        System.out.println("开始找美女");
    }
}
